﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Huirui.Cavan.Domain.MainBoundedContext.Resources;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    public class CurrencyValidator : AbstractValidator<Currency>
    {
        public CurrencyValidator()
        {
            RuleFor(d => d.Name).NotEmpty().WithMessage(Messages.Validate_NameNotEmpty);
            RuleFor(d => d.Corporation).NotNull().WithMessage(Messages.Validate_CorporationNotNull);
            RuleFor(d => d.Rate).GreaterThan(0).WithMessage("汇率必须大于0");
        }
    }
}
